/* *****************************************************************************
 * JFab (http://code.google.com/p/jfab)
 * Copyright (c) 2011 JFab.org
 * Admin jfab@jeffreythompson.net
 *
 * See the file "LICENSE.txt" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * *****************************************************************************/

package org.jfab.core.factory;

import java.util.Collection;
import java.util.Set;

import org.jfab.core.model.CGClass;
import org.jfab.core.model.CGCompilationUnit;
import org.jfab.core.model.CGConstructor;
import org.jfab.core.model.CGEnum;
import org.jfab.core.model.CGField;
import org.jfab.core.model.CGInterface;
import org.jfab.core.model.CGMethod;
import org.jfab.core.model.CGMethodDeclaration;
import org.jfab.core.model.CGType;

/**
 * Defines methods required by a type reference support.
 */
public interface TypeReferenceSupport
{
    /**
     * @param cgType Code generator type.
     */
    void addReferencedType(CGType cgType);

    /**
     * @param cgTypes Referenced code generator types.
     */
    void addReferencedTypes(Collection<CGType> cgTypes);

    /**
     * Clear type references.
     */
    void clear();

    /**
     * @param cgType Code generator type.
     * 
     * @return a new type string.
     */
    String createComponentTypeString(CGType cgType);

    /**
     * @param cgType Code generator type.
     * 
     * @return a new type string.
     */
    String createTypeString(CGType cgType);

    /**
     * Determine the types referenced by the given parameter.
     * 
     * @param cgClass Code generator class.
     */
    void determineReferencedTypes(CGClass cgClass);

    /**
     * Determine the types referenced by the given parameter.
     * 
     * @param cgConstructor Code generator constructor.
     */
    void determineReferencedTypes(CGConstructor cgConstructor);

    /**
     * Determine the types referenced by the given parameter.
     * 
     * @param cgEnum Code generator enum.
     */
    void determineReferencedTypes(CGEnum cgEnum);

    /**
     * Determine the types referenced by the given parameter.
     * 
     * @param cgField Code generator field.
     */
    void determineReferencedTypes(CGField cgField);

    /**
     * Determine the types referenced by the given parameter.
     * 
     * @param cgInterface Code generator interface.
     */
    void determineReferencedTypes(CGInterface cgInterface);

    /**
     * Determine the types referenced by the given parameter.
     * 
     * @param cgMethod Code generator method.
     */
    void determineReferencedTypes(CGMethod cgMethod);

    /**
     * Determine the types referenced by the given parameter.
     * 
     * @param cgMethod Code generator method.
     */
    void determineReferencedTypes(CGMethodDeclaration cgMethod);

    /**
     * @param cgCompilationUnit Code generator compilation unit.
     * 
     * @return the import type names.
     */
    Set<String> getImportTypeNames(CGCompilationUnit cgCompilationUnit);

    /**
     * @return the packageName
     */
    String getPackageName();

    /**
     * @return the referencedTypes
     */
    Set<CGType> getReferencedTypes();

    /**
     * @param cgType Code generator type.
     */
    void removeReferencedType(CGType cgType);

    /**
     * @param packageName the packageName to set
     */
    void setPackageName(String packageName);
}
